﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace WEALTH
{
    public partial class ViewCode : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            Bitmap img = new Bitmap(50, 24);
            Graphics gs = Graphics.FromImage(img);
            gs.Clear(Color.White);

            Random rand = new Random();
            string str = "";
            for (int nI = 0; nI < 4; nI++)
            {
                str = str + rand.Next(9).ToString();
            }
            Session["ViewCode"] = str;
            Font font = new Font("宋体", 18f);
            Brush br = new SolidBrush(Color.Blue);
            gs.DrawString(str, font, br, 0, 0);


            for (int nI = 0; nI < 200; nI++)
            {
                int x = rand.Next(50);
                int y = rand.Next(24);
                img.SetPixel(x, y, Color.Red);

            }

            img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
        }
    }
}